package com.vitas.coin.data.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;

public class MusicType implements Parcelable {

    public long dbId;
    public String id;
    public String name;
    public ArrayList<ChildrenVoiceBean> list;

    public MusicType() {

    }

    public MusicType(String name) {
        this.name = name;
        id = "m" + System.currentTimeMillis();
    }

    public int getNum() {
        return list == null ? 0 : list.size();
    }

    protected MusicType(Parcel in) {
        dbId = in.readLong();
        id = in.readString();
        name = in.readString();
        list = in.createTypedArrayList(ChildrenVoiceBean.CREATOR);
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(dbId);
        dest.writeString(id);
        dest.writeString(name);
        dest.writeTypedList(list);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<MusicType> CREATOR = new Creator<MusicType>() {
        @Override
        public MusicType createFromParcel(Parcel in) {
            return new MusicType(in);
        }

        @Override
        public MusicType[] newArray(int size) {
            return new MusicType[size];
        }
    };
}
